package com.example.viewpager2

import android.widget.CheckBox
import androidx.viewpager2.widget.ViewPager2

/**
 * @author by liliang on 2020/6/13 7:12 PM
 */
class UserInputController(private val viewPager: ViewPager2, private val disableBox: CheckBox) {
    fun setUp() {
        disableBox.isChecked = !viewPager.isUserInputEnabled
        disableBox.setOnCheckedChangeListener { _, isDisabled ->
            viewPager.isUserInputEnabled = !isDisabled
        }
    }
}